﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Domain.Entities.Auditing;

namespace BW.WMS.WareHouseAllot
{
    /// <summary>
    /// 调拨实体
    /// </summary>
    [Table("Allot")]
    public class AllotModel : AuditedAggregateRoot<Guid>
    {
        /// <summary>
        /// 调拨编码
        /// </summary>
        [Required(ErrorMessage = "调拨编码不能为空")] // 非空约束（提示信息可选）
        [MaxLength(50, ErrorMessage = "调拨编码长度不能超过50个字符")] // 最大长度50
        public string AllotCode { get; set; }

        /// <summary>
        /// 调拨状态
        /// 草稿、待审核、通过、驳回、已完成
        /// </summary>
        public string AllotStatus { get; set; } = string.Empty;

        /// <summary>
        /// 调拨类型
        /// </summary>
        public string AllotType { get; set; } = string.Empty;

        /// <summary>
        /// 调拨申请日期
        /// </summary>
        public DateTime? AllotTime { get; set; }

        /// <summary>
        /// 调出仓库（外键）
        /// </summary>
        public Guid? CalloutWareHouseId { get; set; }

        /// <summary>
        /// 调入仓库（外键）
        /// </summary>
        public Guid? FoldWareHouseId { get; set; }

        /// <summary>
        /// 出库状态
        /// 未出库、部分出库、已出库
        /// </summary>
        public string ApperStatus { get; set; } = string.Empty;

        /// <summary>
        /// 入库状态
        /// 未入库、部分入库、已入库
        /// </summary>
        public string GetStatus { get; set; } = string.Empty;

        /// <summary>
        /// 调拨数量
        /// </summary>
        [MaxLength(10)]
        public int AllotNum { get; set; }

        /// <summary>
        /// 调拨金额
        /// </summary>
        [Column(TypeName = "decimal(18,2)")]
        public decimal AllotPrice { get; set; }

        /// <summary>
        /// 经办人
        /// </summary>
        [MaxLength(30, ErrorMessage = "经办人长度不能超过50个字符")]
        public string Operator { get; set; }

        /// <summary>
        /// 调拨货品（外键）
        /// </summary>
        public Guid? GoodsId { get; set; }

        /// <summary>
        /// 部门ID（外键）
        /// </summary>
        public Guid? DeptId { get; set; }

        /// <summary>
        /// 制定人
        /// </summary>
        [MaxLength(30, ErrorMessage = "制定人长度不能超过50个字符")]
        public string PreparedBy { get; set; }=string.Empty;

        /// <summary>
        /// 制单时间
        /// </summary>
        public DateTime? PreparedByTime { get; set; }

        /// <summary>
        /// 审核人
        /// </summary>
        [MaxLength(30, ErrorMessage = "审核人长度不能超过50个字符")]
        public string AuditName { get; set; }= string.Empty;

        /// <summary>
        /// 审核时间
        /// </summary>
        public DateTime? AuditTime { get; set; }

        /// <summary>
        /// 调拨备注
        /// </summary>
        [MaxLength(100, ErrorMessage = "调拨备注长度不能超过100个字符")] // 最大长度100
        public string AllotNotes { get; set; }

        /// <summary>
        /// 创建人
        /// </summary>
        [MaxLength(30, ErrorMessage = "创建人长度不能超过50个字符")]
        public string CreateName { get; set; }

        /// <summary>
        /// 更新人
        /// </summary>
        [MaxLength(30, ErrorMessage = "更新人长度不能超过50个字符")]
        public string UpdateName { get; set; } = string.Empty;

        /// <summary>
        /// 软删除
        /// false: 未删除 true: 已删除
        /// </summary>
        public bool IsDeleted { get; set; } = false;
    }
}
